package com.cgah

/**
 * YEAH THIS CLASS IS ESSENTIALLY A DUP OF AbstractUnitTest
 * there's very little different, the most significant is the
 * super class
 */
abstract class AbstractIntegrationTest extends GroovyTestCase {

    def session
    def params
    def redirectParams
    def flash

    void setupForClass(GroovyObject go) {
        go.class.metaClass.getParams = {-> params }
        go.class.metaClass.redirect = { Map args -> redirectParams = args  }
        go.class.metaClass.getSession = {-> session }
        go.class.metaClass.getFlash = {-> flash }
        def logger = new Expando(debug: { println it }, info: { println it },
                warn: { println it }, error: { println it })
        go.class.metaClass.getLog = {-> logger }

    }

    void setUp() {
        super.setUp()
//      more fail, integration tests load these i think
//      loadCodec(JSON)
//      loadCodec(XML)

//      more fail, this is already done in integration env, but not unit test env
//      System.setProperty(GrailsApplication.ENVIRONMENT, GrailsApplication.ENV_TEST)
        session = [:]
        params = [:]
        redirectParams = [:]
        flash = [:]

    }

    protected void tearDown() {
        flash = null;
        redirectParams = null;
        params = null;
        session = null;
        super.tearDown()
    }

    void testBlah() {
        assertTrue(true);
    }

}
